package com.slz3.business.module.configManagement.conSiteCounty.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.util.UUIDUtils;
import com.slz3.business.frame.util.VE;

import java.time.LocalDateTime;

public class ConSiteCountyFactory {

    /**
     * 初始化基础属性值
     */
    public static ConSiteCounty initBaseFields(ConSiteCounty conSiteCounty) {
        if (conSiteCounty.getUuid() == null) {
            conSiteCounty.setUuid(UUIDUtils.generateUUID());
            conSiteCounty.setCreateTime(LocalDateTime.now());
            if (VE.isEmpty(conSiteCounty.getSerAudit())) {
                conSiteCounty.setSerAudit(AuditFlag.WAIT_SUBMIT);
            }
            if (VE.isEmpty(conSiteCounty.getSerUsing())) {
                conSiteCounty.setSerUsing(UsingFlag.ENABLE);
            }
        } else {
            conSiteCounty.setLastModifyTime(LocalDateTime.now());
        }
        return conSiteCounty;
    }

    /**
     * 初始化基础属性值
     */
    public static ConSiteCounty initBaseFields() {
        return initBaseFields(newTemStyle());
    }

    public static ConSiteCounty newTemStyle() {
        return new ConSiteCounty();
    }

}
